#include "sql_utili.h"

int main()
{
    printf("Content-Type:text/html; charset=utf-8\n\n");
    MYSQL mysql;
    mysql_init(&mysql);
    Connect_MySql(&mysql, "localhost", "root", "a123456", "info");
    
    char user_name[20] = {0};
    char user_passwd[10] = {0};
    parse_name_passwd(user_name, user_passwd);
    //printf("user_name = %s, user_passwd = %s", user_name, user_passwd); 
    
    char sql[100] = {0};
    sprintf(sql, "insert into user_info values(\"%s\",\"%s\")", user_name, user_passwd);
    //printf("sql = %s", sql);

    int res = mysql_query(&mysql, sql);
    if(res != 0)
        printf("<h1 align=center> Register User Fail.</h1>");
    else 
        printf("<h1 align=center> Register User Success.</h1>");
    sleep(2);
    mysql_close(&mysql);

    skip_page("../BigInt_CGI/htdocs/index.html");

    return 0;
}
